home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_1199 / 1675 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  3.6 KB

  1. From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
  2. Date: Mon, 4 Jul 94 11:15:42 +0200
  3. Message-Id: <9407040915.AA00368@issan.informatik.uni-dortmund.de>
  4. To: mint@atari.archive.umich.edu
  5. In-Reply-To: <m0q63pG-0000aKC@sdf.lonestar.org> (ekl@sdf.lonestar.org)
  6. Subject: Memory protection without MultiTOS
  7.  
  8. In an old mail ekl@sdf.lonestar.org (Evan K. Langlois) wrote:
  9.  
  10. |> Yes, for memory protection, your only choice is to run MultiTOS, or no GEM.
  11. |> There is no way around that!
  12.  
  13. Actually, there is.  Here is a patch to allow running the old AES
  14. under memory protection.  It turns all memory requests by the AES into
  15. global accessible, so that the resource tree can be accessed by both
  16. the program and the AES.  Also the first process started by the AES
  17. (the real GEM process) is marked to have global memory protection.
  18. Note that the accessories must run in global memory too, you have to
  19. change the file header appropriately.  There are still problems with
  20. accessories that dynamically request memory during runtime, since it
  21. is allocated in the context of the running program and thus private by
  22. default, but this is considered bad programming style anyway (XCONTROL
  23. 1.31 is such a beast :-/ ).
  24.  
  25. This is kind of a hack, especially the distinction between Malloc from
  26. AES and VDI.  This only works if the AES code is located after the VDI
  27. code in the roms, which is the case in all TOS versions i know of
  28. (1.00, 1.02, 1.04, 3.06), but it may fall over with other versions.
  29.  
  30.  
  31. --- orig/dosmem.c    Wed Feb  2 23:43:02 1994
  32. +++ dosmem.c    Sat Jul  2 15:36:28 1994
  33. @@ -120,8 +120,19 @@
  34.      if (((mode & F_PROTMODE) == 0) &&
  35.          (curproc->ctxt[SYSCALL].pc > 0x00e00000L) &&
  36.          (curproc->ctxt[SYSCALL].pc < 0x00efffffL)) {
  37. +#ifndef MULTITOS
  38. +      extern long gem_start;
  39. +      if (gem_start && curproc->ctxt[SYSCALL].pc >= gem_start)
  40. +        {
  41. +          mode |= F_PROT_G + 0x10;
  42. +          TRACE (("m_xalloc: AES special (call from ROM)"));
  43. +        }
  44. +      else
  45. +#endif
  46. +        {
  47.          mode |= (F_PROT_S + 0x10) | F_KEEP;
  48.          TRACE(("m_xalloc: VDI special (call from ROM)"));
  49. +        }
  50.      }
  51.  /*
  52.   * If the mode argument comes in a zero, then set it to the default
  53. @@ -319,6 +330,9 @@
  54.      char localname[PNAMSIZ+1];
  55.      XATTR xattr;
  56.      int newpid;
  57. +#ifndef MULTITOS
  58. +    extern BASEPAGE *gem_base;
  59. +#endif
  60.  
  61.  #ifdef DEBUG_INFO
  62.  /* tfmt and tail_offs are used for debugging only */
  63. @@ -387,6 +401,13 @@
  64.              DEBUG (("Pexec: invalid protection mode changed to private"));
  65.              flags = (flags & ~F_PROTMODE) | F_PROT_P;
  66.          }
  67. +#ifndef MULTITOS
  68. +        if ((flags & F_PROTMODE) == 0 && curproc->base == gem_base)
  69. +          {
  70. +            flags |= F_PROT_G;
  71. +            TRACE (("p_exec: AES special"));
  72. +          }
  73. +#endif
  74.                      /* and fall through */
  75.      case 5:
  76.          mkbase = 1;
  77. --- orig/main.c    Fri Feb 11 20:37:16 1994
  78. +++ main.c    Fri Jul  1 18:43:06 1994
  79. @@ -125,6 +125,8 @@
  80.  static int init_is_gem = 1;    /* set to 1 if init_prg is GEM */
  81.  #else
  82.  static int init_is_gem = 0;    /* set to 1 if init_prg is GEM */
  83. +BASEPAGE *gem_base = 0;
  84. +long gem_start = 0;
  85.  #endif
  86.  static const char *init_prg = 0;
  87.  
  88. @@ -893,6 +895,11 @@
  89.            (char *)((long)F_FASTLOAD | F_ALTLOAD | F_ALTALLOC | F_PROT_S),
  90.            (char *)"\0", init_env);
  91.          bp->p_tbase = *((long *) EXEC_OS );
  92. +#ifndef MULTITOS
  93. +        if (((long *) sysbase[5])[0] == 0x87654321)
  94. +          gem_start = ((long *) sysbase[5])[2];
  95. +        gem_base = bp;
  96. +#endif
  97.          r = p_exec(106, (char *)"GEM", bp, 0L);
  98.          pid = (int)r;
  99.          if (pid > 0) {
  100.  
  101. -- 
  102. +------------------------------------------------------------------------+
  103. Andreas Schwab                                      "And now for something
  104. schwab@ls5.informatik.uni-dortmund.de                completely different"
  105.